#pragma once

#include <functional>
#include <QtGlobal>

namespace util {
  //
  // util::LinearTransform
  //

  class LinearTransform : public std::unary_function<qreal, qreal> {
  public:
    LinearTransform(qreal Scale_ = 1.0, qreal Offset_ = 0.0);
    LinearTransform(const std::pair<qreal, qreal> &, const std::pair<qreal, qreal> &);
    qreal GetOffset() const;
    qreal GetScale() const;
    LinearTransform Invert() const;
    result_type operator()(argument_type) const;

  private:
    qreal mScale;
    qreal mOffset;
  };

} // namespace util